<?php

namespace Controller;

session_start();

require_once 'Controller/LoginController.php';
require_once 'Controller/RegisterController.php';

require_once 'Model/dbsettings.php';
require_once 'Model/Database.php';

require_once 'View/RegisterView.php';
require_once 'View/Validation.php';

$title = "Lab 3 - Login databas";

class MasterController{	

	public static function doControll()
	{
		$LoginController = new \Controller\LoginController();
		$RegisterController = new \Controller\RegisterController();
		
		
		$Database = new \Model\Database();
		$Database->Connect(new \Model\dbsettings());		
		
		// Gör kontroll om användaren vill logga in
		$html = $LoginController->DoControll($Database);
							
		// Gör kontroll om avändaren vill registrera sig
		$html .= $RegisterController->DoControll($Database);
						
		//Stänger databaskopplingen.
		$Database->Close();	
		return $html;
	}	
}
?>


<!DOCTYPE html>
<html>
<head>
	<title><?php echo $title; ?></title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link href="css/stylesheet.css" rel="stylesheet" type="text/css">
</head>
	<body>
		<div id="wrapper">
			<?php 
				echo MasterController::doControll();
			?>
		</div>
	</body>
</html>